1. Field of the Invention
The present invention relates to an image compression apparatus for compressing still image data.
2. Description of the Background Art
As formats for compressing still image data, conventionally, the JPEG (Joint Photographic Experts Group) format has been widely used. Further, the HD Photo format which allows prevention of degradation of images and ensures high compression ratio, as compared with the JPEG format, has been developed. The HD Photo format is discussed in detail in Non-Patent Documents, such as “HD Photo-Photographic Still Image File Format” (Nov. 7, 2006, Microsoft Corporation, URL: http://www.microsoft.com/whdc/xps/hdphotodpk.mspx) and “Coding of Still Pictures” (Dec. 19, 2007, International Organisation for Standardisation and International Electorotechnical Commission, URL: http://www.itscj.ipsj.or.jp/sc29/open/29view/29n9026t.doc.)
An image compression apparatus based on the HD Photo format (hereinafter, referred to simply as an “image compression apparatus”) performs frequency conversion of still image data on a macroblock-by-macroblock basis, to generate DC (direct current) component data and two types of AC (alternating current) component data. One of the two types of AC component data is low-pass component data called “Low Pass” and the other one is high-pass component data called “High Pass”. The image compression apparatus performs quantization and predictive coding of these component data. Then, quantization data of each component is entropy coded and outputted as a stream.
FIG. 9 is a block diagram showing an image compression apparatus 100 in the background art. The image compression apparatus 100 is an apparatus for converting still image data into compressed image data in the HD Photo format. The image compression apparatus 100 comprises a first frequency converter 101, a second frequency converter 102, a quantization part 103, a predictive processing part 104, a symbol generation part 105 and an entropy coding part 106.
The first frequency converter 101 performs frequency conversion of the first hierarchy on still image data inputted to the image compression apparatus 100, to output DC component data of the first hierarchy and AC component data of the first hierarchy.
The second frequency converter 102 further performs frequency conversion on the DC component data of the first hierarchy outputted from the first frequency converter 101, to output DC component data of the second hierarchy and AC component data of the second hierarchy.
Hereinafter, the AC component data of the first hierarchy is referred to as “high-pass component data”. The DC component data of the second hierarchy is referred to simply as “DC component data” and the AC component data of the second hierarchy is referred to as “low-pass component data”.
The low-pass component data and the high-pass component data each have fifteen pieces of conversion factor data. Specifically, the low-pass component data has a block consisting of fifteen pieces of conversion factor data for each of three channels of YUV. The high-pass component data has sixteen blocks each consisting of fifteen pieces of conversion factor data and each of the sixteen blocks has conversion factor data for each of three channels of YUV. On the other hand, the DC component data has one piece of conversion factor data for each of three channels of YUV.
The quantization part 103 performs quantization on the DC component data, the low-pass component data and the high-pass component data, and the predictive processing part 104 performs predictive coding on quantization data. The symbol generation part 105 generates a symbol string from a bit string of predictive coded quantization data, and the entropy coding part 106 performs entropy coding on the symbolized quantization data, to generate the compressed image data.
As shown in FIG. 9, a first buffer 111 and a second buffer 112 are connected to the symbol generation part 105. The symbol generation part 105 stores the quantization data of one block outputted from the predictive processing part 104 into the first buffer 111, and at the same timing, it takes the quantization data of one block out from the second buffer 112 to output symbol data. Further, the symbol generation part 105 stores the quantization data of one block outputted from the predictive processing part 104 into the second buffer 112, and at the same timing, it takes the quantization data of one block from the first buffer 111 to output symbol data. Thus, by switching the input and output of the two buffers, it is intended to increase the speed of the processing.
FIG. 10 is a view showing a data format of quantization data stored in the first buffer 111 and the second buffer 112. Herein, discussion will be made on an exemplary case, as shown in FIG. 10, where a data string of one block, consisting of fifteen pieces of quantization data {0, 0, 3, 0, 0, 3, 10, 0, 0, 0, −1, 0, 2, 0, 0}, is stored in the first buffer 111.
First, since the first and second quantization data are zero coefficients, no quantization data is stored in the first buffer 111. Since the third quantization data is “3” which is a non-zero coefficient, information of an absolute value (ABS)=“3”, a zero run (ZERO_RUN)=“2” and a sign (SIGN)=“0” is stored in the first buffer 111. The zero run refers to the number of sequential zero coefficients present before the non-zero coefficient in the block. As to the sign, “0” indicates positive and “1” indicates negative. Further, the symbol generation part 105 has a register for counting the number of sequential zeros.
Subsequently, since the fourth and fifth quantization data are zero coefficients, no quantization data is stored in the first buffer 111. Since the sixth quantization data is “3” which is a non-zero coefficient, {ABS, ZERO_RUN, SIGN)={3, 2, 0} is stored in the first buffer 111. Further, since the seventh quantization data is “10” which is a non-zero coefficient, {ABS, ZERO_RUN, SIGN)={10, 0, 0} is stored in the first buffer 111.
Subsequently, since the eighth, ninth and tenth quantization data are zero coefficients, no quantization data is stored in the first buffer 111. With respect to the eleventh quantization data, {ABS, ZERO_RUN, SIGN)={1, 3, 1} is stored in the first buffer 111, and with respect to the thirteenth quantization data, {2, 1, 0} is stored in the first buffer 111. Then, with respect to the last quantization data, exceptionally, {0, 2, 0} is stored in the first buffer 111.
Thus, the data string of quantization data of one block, being symbolized, is stored in the first buffer 111. Then, at the timing where the quantization data of the next block is stored in the second buffer 112, the quantization data stored in the first buffer 111 is outputted as the symbol data. At that time, an index is also generated and outputted as part of the symbol data.
FIG. 11 is a view showing contents of the symbol data. FIG. 11 shows the symbol data formed of the data string of quantization data shown in FIG. 10. In FIG. 11, contents of the quantization data inputted to the symbol generation part 105 are shown in the rows above the double line and contents of the symbol data outputted from the symbol generation part 105 are shown in the rows below the double line. In the symbol data, values of ABS, ZERO_RUN and SIGN are the same as those stored in the first buffer 111. As to the values of “ABS”, however, values obtained by subtracting “1” from the values stored in the first buffer 111 are outputted as the symbol data in accordance with the specification of the HD Photo format.
As to INDEX in the symbol data, detailed discussion will be made in the preferred embodiment of the present invention but will be omitted herein. The INDEX includes information indicating a relation between the absolute value of the non-zero coefficient and “1” and information on the quantization data following the non-zero coefficient.
Thus, the symbol data is not outputted at the timing where a zero coefficient presents itself but is outputted intermittently at the timing where a non-zero coefficient presents itself. Since there are fifteen pieces of quantization data in one block, fifteen data output timings are needed in order to output the symbol data from the first buffer 111 or the second buffer 112. On the other hand, fifteen data input timings are needed in order to store the quantization data into the first buffer 111 or the second buffer 112. Thus, the timing of inputting the quantization data into one of the two buffers and the timing of outputting the symbol data from the other buffer are synchronized, and this makes it possible to efficiently generate the symbols at high speed.
There are some cases, however, where the timings become out of sync. As discussed above, the high-pass component data and the low-pass component data are each a set of blocks each consisting of fifteen pieces of quantization data and the DC component data consists of only three pieces of quantization data for YUV.
At to the timing of switching from the high-pass component data to the DC component data, it takes a time period for three pieces of data to input the DC component data to the first buffer 111 while it takes a time period for fifteen pieces of data to output the symbol data from the second buffer 112. For this reason, there occurs an idle time in the timing of inputting data to the first buffer 111.
At to the timing of switching from the DC component data to the low-pass component data, it takes a time period for three pieces of data to output the symbol data from the first buffer 111 while it takes a time period for fifteen pieces of data to input the low-pass component data to the second buffer 112. For this reason, there occurs an idle time in the timing of outputting the symbol data.
Thus, though it is intended to increase the speed by using two buffers, the input/output idle time for twelve pieces of data occurs two times for each macroblock, and it is desired to further increase the processing time.
Further, each of the first and second buffers 111 and 112 needs a data size for the bit length of the quantization data×15 for ABS, a data size for the 4 bits×15 for ZERO_RUN and a data size for 1 bit×15 for SIGN. Therefore, if the bit length of the quantization data is 32 bits, the two buffers needs (32+4+1)×15×2 bits in total. Considering that downsizing and power saving are strongly required of electronic equipments incorporating the HD Photo, it is desired to reduce the buffer size to a minimum.